package com.ccb.sc.common.modules.order.convert;

import com.ccb.sc.common.modules.order.entity.OrderReturn;
import com.ccb.sc.common.modules.order.vo.OrderReturnCreateVo;
import com.ccb.sc.common.modules.order.vo.OrderReturnListVo;
import com.ccb.sc.common.modules.order.vo.OrderReturnSettingsVo;
import com.ccb.sc.common.modules.setting.vo.OrderSettingsVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import static org.mapstruct.factory.Mappers.getMapper;

/**
 * @author ken
 * @version 1.0
 * @date 2020-10-07
 */
@Mapper
public interface OrderReturnConvert {

    OrderReturnConvert INSTANCE = getMapper(OrderReturnConvert.class);

    @Mapping(target = "returnType", expression = "java(com.ccb.sc.common.modules.order.enums.OrderReturnType.getByValue(createVo.getReturnType()))")
    OrderReturn createVo2Entity(OrderReturnCreateVo createVo);

    OrderReturnListVo entity2ListVo(OrderReturn entity);

    OrderReturnSettingsVo setting2Vo(OrderSettingsVo setting);
}
